package com.huawei.skinner.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import o.SkinAttr;
import o.SkinnableView;
import o.fle;
import o.fln;
import o.flp;
import o.flr;
import o.flt;
import o.fmr;
import o.fms;
import o.fmt;
import o.LayoutInflaterCompatHC;

public class SkinBaseAppcompatActivity extends AppCompatActivity implements fle, fln, flp {
    private flt ˊॱ;
    private List<SkinnableView> ˋॱ = new ArrayList();
    private boolean ॱˊ = true;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (this.ॱˊ) {
            fmt.ˏ(LayoutInflater.class, getLayoutInflater(), "mFactorySet", Boolean.valueOf(false));
            this.ˊॱ = new flt(this);
            LayoutInflaterCompatHC.setLayoutInfaltorFactory2(getLayoutInflater(), this.ˊॱ);
        }
    }

    public void onResume() {
        super.onResume();
        flr.ˋ(this).ॱ(this);
    }

    public void onDestroy() {
        super.onDestroy();
        flr.ˋ(this).ˎ(this);
        ʻॱ();
    }

    public void ـ() {
        if (this.ˋॱ.size() > 0) {
            for (SkinnableView ˊ : this.ˋॱ) {
                ˊ.ˊ();
            }
        }
    }

    public void ˑ() {
        ॱˊ();
    }

    public void ˊ(View view, String str, int i) {
        if (this.ॱˊ && this.ˊॱ != null) {
            this.ˊॱ.ˊ(this, view, str, i);
        }
    }

    public SkinnableView ˋ(SkinnableView o_fkw) {
        int indexOf = this.ˋॱ.indexOf(o_fkw);
        if (indexOf >= 0) {
            SkinnableView o_fkw2 = (SkinnableView) this.ˋॱ.get(indexOf);
            List ˏ = o_fkw2.ˏ();
            for (SkinAttr o_fko : o_fkw.ˏ()) {
                int indexOf2 = ˏ.indexOf(o_fko);
                if (indexOf2 >= 0) {
                    ˏ.set(indexOf2, o_fko);
                } else {
                    ˏ.add(o_fko);
                }
            }
            if (o_fkw.ˎ() != null) {
                return o_fkw2;
            }
            o_fkw.ˎ(fms.ˎ().ॱ(o_fkw.ˋ().getClass()));
            return o_fkw2;
        }
        this.ˋॱ.add(o_fkw);
        o_fkw.ˎ(fms.ˎ().ॱ(o_fkw.ˋ().getClass()));
        return o_fkw;
    }

    public void ॱˊ() {
        if (!fmr.ˋ(this.ˋॱ)) {
            Collection arrayList = new ArrayList();
            for (SkinnableView o_fkw : this.ˋॱ) {
                if (o_fkw.ˋ() == null) {
                    arrayList.add(o_fkw);
                } else {
                    o_fkw.ˎ(false);
                }
            }
            if (!fmr.ˋ(arrayList)) {
                this.ˋॱ.removeAll(arrayList);
            }
        }
    }

    public void ʻॱ() {
        if (!fmr.ˋ(this.ˋॱ)) {
            for (SkinnableView ॱ : this.ˋॱ) {
                ॱ.ॱ();
            }
            this.ˋॱ.clear();
        }
    }
}
